package com.example.mapper;

import com.example.dto.SetmealDto;
import com.example.pojo.Setmeal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface SetmealMapper {

    @Select("SELECT COUNT(*) FROM setmeal WHERE type=#{genderType}")
    int getTotalSetmealCount(Integer genderType);

    @Select("SELECT setmeal.smId, setmeal.name, setmeal.type, setmeal.price, " +
            "checkitem.ciId, checkitem.ciName, checkitem.ciContent, checkitem.meaning, checkitem.remarks " +
            "FROM setmeal " +
            "JOIN setmealdetailed ON setmeal.smId = setmealdetailed.smId " +
            "JOIN checkitem ON setmealdetailed.ciId = checkitem.ciId WHERE setmeal.type = #{genderType}")
    List<SetmealDto>  getSetmealWithCheckItems(Integer genderType);

    @Select("SELECT * FROM setmeal WHERE smId = #{smId}")
    Setmeal getSetmealById(Integer smId);

}
